<template>
  <div class="top250">
    <div class="item" v-for="item of movies" :key="item._id">
      <router-link :to="{path:'/topDetail',query:{id:item._id}}">
      <img class="pic" :src="item.pic" alt="">
      </router-link>
      <div>{{item.title}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Top250',
  data(){
    return {
      movies:[]
    }
  },
  mounted() {
    this.$http.get('http://47.108.197.28:4000/api/movie/top250').then(res=>{
     this.movies = res.data.res
    })
  },
}
</script>

<style scoped>
.top250{
  padding-left: 50px;
  display: flex;
  flex-wrap: wrap;
}
.item{
  width: 180px;
  margin-bottom: 20px;
}
.pic{
  width:150px;
  height: 170px;
}
</style>
